package com.wuye.controller;

import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.wuye.VO.WyYbMoneyVo;
import com.wuye.dto.WyYbMoneyDto;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wuye.common.annotation.Log;
import com.wuye.common.core.controller.BaseController;
import com.wuye.common.core.domain.AjaxResult;
import com.wuye.common.enums.BusinessType;
import com.wuye.domain.WyYbMoney;
import com.wuye.service.IWyYbMoneyService;
import com.wuye.common.utils.poi.ExcelUtil;
import com.wuye.common.core.page.TableDataInfo;

/**
 * 仪表-----周期收费Controller
 * 
 * @author jack
 * @date 2024-11-22
 */
@RestController
@RequestMapping("/yibiaoManagement/money")
public class WyYbMoneyController extends BaseController
{
    @Autowired
    private IWyYbMoneyService wyYbMoneyService;

//    /**
//     * 查询仪表-----周期收费列表
//     */
//    @PreAuthorize("@ss.hasPermi('yibiaoManagement:money:list')")
//    @GetMapping("/list")
//    public TableDataInfo list(WyYbMoney wyYbMoney)
//    {
//        startPage();
//        List<WyYbMoney> list = wyYbMoneyService.selectWyYbMoneyList(wyYbMoney);
//        return getDataTable(list);
//    }
//
//    /**
//     * 导出仪表-----周期收费列表
//     */
//    @PreAuthorize("@ss.hasPermi('yibiaoManagement:money:export')")
//    @Log(title = "仪表-----周期收费", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, WyYbMoney wyYbMoney)
//    {
//        List<WyYbMoney> list = wyYbMoneyService.selectWyYbMoneyList(wyYbMoney);
//        ExcelUtil<WyYbMoney> util = new ExcelUtil<WyYbMoney>(WyYbMoney.class);
//        util.exportExcel(response, list, "仪表-----周期收费数据");
//    }
//
//    /**
//     * 获取仪表-----周期收费详细信息
//     */
//    @PreAuthorize("@ss.hasPermi('yibiaoManagement:money:query')")
//    @GetMapping(value = "/{ybMoyId}")
//    public AjaxResult getInfo(@PathVariable("ybMoyId") Long ybMoyId)
//    {
//        return success(wyYbMoneyService.selectWyYbMoneyByYbMoyId(ybMoyId));
//    }
//
//    /**
//     * 新增仪表-----周期收费
//     */
//    @PreAuthorize("@ss.hasPermi('yibiaoManagement:money:add')")
//    @Log(title = "仪表-----周期收费", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody WyYbMoney wyYbMoney)
//    {
//        return toAjax(wyYbMoneyService.insertWyYbMoney(wyYbMoney));
//    }
//
//    /**
//     * 修改仪表-----周期收费
//     */
//    @PreAuthorize("@ss.hasPermi('yibiaoManagement:money:edit')")
//    @Log(title = "仪表-----周期收费", businessType = BusinessType.UPDATE)
//    @PutMapping
//    public AjaxResult edit(@RequestBody WyYbMoney wyYbMoney)
//    {
//        return toAjax(wyYbMoneyService.updateWyYbMoney(wyYbMoney));
//    }
//
//    /**
//     * 删除仪表-----周期收费
//     */
//    @PreAuthorize("@ss.hasPermi('yibiaoManagement:money:remove')")
//    @Log(title = "仪表-----周期收费", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{ybMoyIds}")
//    public AjaxResult remove(@PathVariable Long[] ybMoyIds)
//    {
//        return toAjax(wyYbMoneyService.deleteWyYbMoneyByYbMoyIds(ybMoyIds));
//    }

    /**
     * 查询仪表-----周期收费列表
     */
    @PreAuthorize("@ss.hasPermi('yibiaoManagement:money:list')")
    @GetMapping("/list")
    public TableDataInfo list(WyYbMoneyDto wyYbMoneyDto)
    {
        startPage();
        List<WyYbMoneyVo> wyYbMoneyVos = wyYbMoneyService.selectWyYbMoneyList(wyYbMoneyDto);
        return getDataTable(wyYbMoneyVos);
    }

//    /**
//     * 导出仪表-----周期收费列表
//     */
//    @PreAuthorize("@ss.hasPermi('yibiaoManagement:money:export')")
//    @Log(title = "仪表-----周期收费", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, WyYbMoney wyYbMoney)
//    {
//        List<WyYbMoney> list = wyYbMoneyService.selectWyYbMoneyList(wyYbMoney);
//        ExcelUtil<WyYbMoney> util = new ExcelUtil<WyYbMoney>(WyYbMoney.class);
//        util.exportExcel(response, list, "仪表-----周期收费数据");
//    }

    /**
     * 获取仪表-----周期收费详细信息
     */
    @PreAuthorize("@ss.hasPermi('yibiaoManagement:money:query')")
    @GetMapping(value = "/{ybMoyId}")
    public AjaxResult getInfo(@PathVariable("ybMoyId") Long ybMoyId)
    {
        return success(wyYbMoneyService.selectWyYbMoneyByYbMoyId(ybMoyId));
    }

    /**
     * 新增仪表-----周期收费
     */
    @PreAuthorize("@ss.hasPermi('yibiaoManagement:money:add')")
    @Log(title = "仪表-----周期收费", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WyYbMoney wyYbMoney)
    {
        return toAjax(wyYbMoneyService.insertWyYbMoney(wyYbMoney));
    }

    /**
     * 修改仪表-----周期收费
     */
    @PreAuthorize("@ss.hasPermi('yibiaoManagement:money:edit')")
    @Log(title = "仪表-----周期收费", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WyYbMoney wyYbMoney)
    {
        return toAjax(wyYbMoneyService.updateWyYbMoney(wyYbMoney));
    }

    /**
     * 删除仪表-----周期收费
     */
    @PreAuthorize("@ss.hasPermi('yibiaoManagement:money:remove')")
    @Log(title = "仪表-----周期收费", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ybMoyIds}")
    public AjaxResult remove(@PathVariable Long[] ybMoyIds)
    {
        return toAjax(wyYbMoneyService.deleteWyYbMoneyByYbMoyIds(ybMoyIds));
    }

    /**
     * 换表
     */
    @PreAuthorize("@ss.hasPermi('yibiaoManagement:money:edit')")
    @Log(title = "仪表-----周期收费", businessType = BusinessType.UPDATE)
    @PutMapping("/newBiao")
    public AjaxResult newBiao(@RequestBody WyYbMoney wyYbMoney)
    {
        return toAjax(wyYbMoneyService.updateWyYbMoney2(wyYbMoney));
    }
}
